//
//  ImageLoadPlaceholder.swift
//  ContactPoster
//
//  Created by TSYH on 2023/11/22.
//

import UIKit
import Kingfisher
import SnapKit

public class ImageLoadPlaceholder: UIView, Placeholder {
    lazy var imageView = UIImageView()
    let loadingView = UIActivityIndicatorView(style: .medium)
    
    convenience init(with placeHolder: String) {
        self.init(frame: .zero)
        imageView.image = UIImage(named: placeHolder)
    }
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        backgroundColor = .clear
        isUserInteractionEnabled = false
        
        imageView.contentMode = .scaleAspectFill
        imageView.isUserInteractionEnabled = false
        addSubview(imageView)
        imageView.snp.makeConstraints { make in
            make.edges.equalToSuperview()
        }
        
//        addSubview(loadingView)
//        loadingView.snp.makeConstraints { make in
//            make.width.height.equalTo(24)
//            make.center.equalToSuperview()
//        }
//        loadingView.startAnimating()
    }
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
}
